﻿using Huirui.Cavan.Domain.Seedwork;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation.Attributes;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    [Serializable]
    [Validator(typeof(JobValidator))]
    public class Job : Persistent
    {
        protected string _name;
        protected string _remark;
        protected Corporation _corporation;

        public Job()
        { 
        }

        public Job(string name, string remark, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation)
        {
            this._name = name;
            this._remark = remark;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
        }

        public virtual string Name
        {
            get { return _name; }
            set
            {
                if (value != null && value.Length > 20)
                    throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
                _name = value;
            }
        }

        public virtual string Remark
        {
            get { return _remark; }
            set
            {
                _remark = value;
            }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }
    }
}
